cmake_minimum_required(VERSION 3.15)

# KWDB C++ SDK Library
add_library(kwdb_sdk
    src/client.cpp
    src/transport.cpp
    src/stream_client.cpp  # NEW: High-performance streaming client
    src/batcher.cpp        # Auto-batching with backpressure
    src/retry_policy.cpp   # Exponential backoff retry
    src/security_util.cpp  # Security: TLS & Authentication
    src/ilp_client.cpp     # ILP/HTTP client with GZIP support
)

target_include_directories(kwdb_sdk
    PUBLIC
        ${CMAKE_CURRENT_SOURCE_DIR}/include
    PRIVATE
        ${CMAKE_CURRENT_SOURCE_DIR}/src
        ${CMAKE_BINARY_DIR}  # For generated proto headers
)

target_link_libraries(kwdb_sdk
    PUBLIC
        ingest_proto
    PRIVATE
        z  # zlib for GZIP compression
)

# C++17 required for structured bindings in transport.cpp
target_compile_features(kwdb_sdk PUBLIC cxx_std_17)